#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int maximizeSum(int* nums, int numsSize, int k)
{
    int max = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (max < nums[i])
            max = nums[i];
    }
    return (k * (max + max + k - 1)) / 2;
}